package com.bsdsma.fengheguaiapp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bsdsma.fengheguaiapp.entity.Room;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.bsdsma.fengheguaiapp.dto.DataGroupByDateDto;

import java.util.Date;
import java.util.List;

/**
* 房间种类 Mybatis数据库操作接口
*/
@Mapper
public interface RoomMapper extends BaseMapper<Room> {

    @Select("select DATE_FORMAT(ct, '%Y-%m-%d') `day`, count(1) num from room where ct >= #{beginDate} and ct <= #{endDate} group by `day` order by `day`;")
    List<DataGroupByDateDto> countByDay(@Param(value = "beginDate") Date beginDate, @Param(value = "endDate") Date endDate);
}